..
/
download
<?xml version='1.0'?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!-- added dmc to ids to make them unique in pubs -->
<xsl:template name="do-list-item">
<xsl:param name="dingbat">•</xsl:param>
<xsl:param name="dingbat-align">start</xsl:param>
<xsl:param name="my-after-spacing">0pt</xsl:param>
<fo:list-item space-after="{$my-after-spacing}">
<xsl:call-template name="CHECK-ID"> </xsl:call-template>
<fo:list-item-label
end-indent="label-end()"
text-align="{$dingbat-align}">
<fo:block>
<xsl:value-of select="$dingbat"/>
</fo:block>
</fo:list-item-label>
<fo:list-item-body
start-indent="body-start()">
<!-- removed extraneous fo block that was causing extra spacing -->
<xsl:apply-templates/>
</fo:list-item-body>
</fo:list-item>
</xsl:template>
<!-- PROCEDURE CHECK id ATTRIBUTE If id attribute exist, add the id value to fo:block
id attribute value for reference -->
<xsl:template name="CHECK-ID">
<xsl:if test="@id">
<xsl:attribute name="id">
<!-- added dmc to ids to make them unique in pubs -->
<xsl:apply-templates select="//dmodule/identAndStatusSection/dmAddress/dmIdent/dmCode"/>
<xsl:value-of select="@id"/>
</xsl:attribute>
</xsl:if>
</xsl:template>
<!-- List titles
From S1000D:
The list title line must be aligned to the left type limit and presented in 10/11 pt.
The normal leading from a preceding headline, paragraph, list item, figure title line, table footer (closing line), last line in a warning, caution or note, etc, to the list title line must be used.
If a title is used, eg Definition of terms: in the example below, and the definition list continues on the next page, the title must be repeated followed by two spaces and the caption "(Continued)" on the top of the continuation page.
-->
<xsl:template match="sequentialList/title | randomList/title | attentionSequentialList/title">
<!-- From S1000D: The leading between the title line and the first list item must be 14 pt (equal to an extra 4 pt leading added after the title). -->
<!-- From S1000D: Bold must be used for titles for random lists and sequential lists. -->
<fo:block space-after="4pt" font-weight="bold" keep-with-next="always">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<!-- Random lists
From S1000D:
The prefixes must be consistently used and presented throughout each data module.
The list items within unordered lists on all three levels must be separated by normal leading, 11 pt, giving no extra leading between the same levels of unordered list items.
Sub-subunordered (level 3) list items starts with en-dash [-] as the prefix indented 14 mm from the left type limit. The text must be indented 7 mm further (21 mm from left type limit).
"The paragraphs within a list item must be separated by an extra leading of 8 pt.
This applies on all levels."
-->
<xsl:template match="randomList">
<xsl:apply-templates select="title"/>
<!-- From S1000D, The text must be indented 7 mm.
For subunordered (level 2) list items, the text must be indented 7 mm further (14 mm from left type limit), prefix indented 7 mm from the left type limit .
Sub-subunordered (level 3) list items the prefix must be indented 14 mm from the left type limit. The text must be indented 7 mm further (21 mm from left type limit).
-->
<!--From S1000D, An extra leading of 8 pt must be added after the last list item on each of the three levels. -->
<fo:list-block space-after="8pt"
provisional-distance-between-starts="7mm"
provisional-label-separation="2mm">
<xsl:apply-templates select="*[not(self::title)]"/>
</fo:list-block>
</xsl:template>
<xsl:template match="randomList/listItem | attentionRandomListItem">
<xsl:variable name="prefix-code">
<xsl:choose>
<xsl:when test="../@listItemPrefix">
<xsl:value-of select="../@listItemPrefix"/>
</xsl:when>
<xsl:otherwise>pf02</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="mydingbat">
<!-- From S1000D: for notes, the list item prefix must be a dash. -->
<xsl:choose>
<xsl:when test="ancestor::note">
<xsl:text>-</xsl:text>
</xsl:when>
<!-- From S1000D: For warnings, The list item prefix must be a bullet. -->
<xsl:when test="ancestor::warning">
<xsl:text>•</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="$prefix-code='pf01'">
<xsl:text></xsl:text>
</xsl:when>
<xsl:when test="$prefix-code='pf02'">
<xsl:choose>
<xsl:when test="count(ancestor::randomList)=1 or parent::attentionRandomList">
<xsl:text>-</xsl:text>
</xsl:when>
<xsl:when test="count(ancestor::randomList)=2">
<xsl:text>•</xsl:text>
</xsl:when>
<xsl:when test="count(ancestor::randomList)=3">
<xsl:text>-</xsl:text>
</xsl:when>
<xsl:otherwise>INVALID RANDOM LIST LEVEL</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$prefix-code='pf03'">
<xsl:text>-</xsl:text>
</xsl:when>
<xsl:when test="$prefix-code='pf04'">
<xsl:text>⊙</xsl:text>
</xsl:when>
<xsl:when test="$prefix-code='pf05'">
<xsl:text>⃝</xsl:text>
</xsl:when>
<xsl:when test="$prefix-code='pf06'">
<xsl:text>☐</xsl:text>
</xsl:when>
<xsl:when test="$prefix-code='pf07'">
<xsl:text>•</xsl:text>
</xsl:when>
<xsl:otherwise>INVALID listItemPrefix</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="myspacing">
<xsl:choose>
<xsl:when test="descendant::randomList | descendant::sequentialList">
<xsl:text>4pt</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>0pt</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="do-list-item">
<!-- From S1000D, Unordered list items at level 1, start with an en-dash [-] as the prefix aligning the left type limit. -->
<xsl:with-param name="dingbat"><xsl:value-of select="$mydingbat"/></xsl:with-param>
<xsl:with-param name="dingbat-align">start</xsl:with-param>
<xsl:with-param name="my-after-spacing"><xsl:value-of select="$myspacing"/></xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- ATTENTION RANDOM LIST -->
<!-- Assume attention lists are formatted the same but don't have title and can't be nested-->
<xsl:template match="attentionRandomList">
<fo:list-block space-after="8pt"
provisional-distance-between-starts="7mm"
provisional-label-separation="2mm">
<xsl:if test="normalize-space(preceding-sibling::text())">
<xsl:attribute name="space-before">
<xsl:text>8pt</xsl:text>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</fo:list-block>
</xsl:template>
<!-- Sequential lists
From S1000D:
Only one ordered list must be placed under a sidehead.
Ordered lists must be numbered with Arabic numerals.
Subordered lists must be numbered.
The number must start with the number of the preceding item followed by a number starting with "1".
The numbers must be separated by a period [.].
The number in subordered lists must be indented 7 mm from the left type limit.
The text must be indented 7 mm further (14 mm from left type limit).
The text indent can be extended in steps of 7 mm as necessary, eg if one of the numbers is larger than 9, eg 6.12, 12.6, 10.10.
The indentation must be consistent within each ordered or subordered list.
Each list item, on any level, can consist of one or more paragraphs and must be separated by an extra leading of 8 pt.
The presentation rules for subunordered lists (2.6.2) must be used.
-->
<xsl:template match="sequentialList | attentionSequentialList">
<xsl:apply-templates select="title"/>
<!-- From S1000D: There are two levels of ordered lists, both indented with a multiple of 7 mm. -->
<!-- From S1000D: The text must be indented 7 mm. -->
<!-- The text indent can be extended in steps of 7 mm as necessary, eg if one of the numbers is larger than 9, eg 6.12, 12.6, 10.10. -->
<!-- *** Note: the labels for second-level lists will not fit in 7mm if either level of the lists exceeds single digits, for example, 2.10.
Therefore, the indent was changed to 9mm to accommodate and the S1000D chapter owner was notified that this requirement does not work. -->
<!-- From S1000D: The additional leading after each list item on both levels must be the same as for text paragraphs, 8 pt. -->
<fo:list-block
provisional-label-separation="2mm"
space-after="9pt">
<xsl:if test="normalize-space(preceding-sibling::text())">
<xsl:attribute name="space-before">
<xsl:text>8pt</xsl:text>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="provisional-distance-between-starts">
<xsl:choose>
<xsl:when test="count(ancestor-or-self::sequentialList)=1 or count(ancestor-or-self::attentionSequentialList)=1">
<xsl:text>7mm</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>14mm</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:apply-templates select="*[not(self::title)]"/>
</fo:list-block>
</xsl:template>
<xsl:template match="sequentialList/listItem | attentionSequentialListItem">
<xsl:call-template name="do-list-item">
<xsl:with-param name="dingbat">
<!-- From S1000D: The number, starting with "1", must align the left type limit. -->
<!-- From S1000D: There must be no period [.] after the last digit of the number. -->
<xsl:choose>
<xsl:when test="self::listItem">
<xsl:number count="sequentialList/listItem" from="content" level="multiple" format="1.1"/>
</xsl:when>
<xsl:otherwise>
<xsl:number count="attentionSequentialListItem" from="content" level="single" format="1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:with-param>
<xsl:with-param name="dingbat-align" select="'start'"/>
<xsl:with-param name="my-after-spacing">8pt</xsl:with-param>
</xsl:call-template>
</xsl:template>
<!-- Definition lists and legends
From S1000D:
"The presentation of a definition list is the same as for an informal table (refer to Para 2.8.2) with
the following differences:
"The first column with the term has a width of 50 mm and the second column with the definition
has a width of 100 mm."
"The presentation of a legend is the same as for an informal table (refer to Para 2.8.2) with the
following differences:
− mandatory use of a title (caption)
− no leading before the first row
− having a leading of 4 pt between rows"
Four columns must be used for presentation of a legend. (Item numbers <listItemTerm> in 1 & 3, Definition <listItemDefinition> in 2 & 4),
-->
<!-- From S1000D: Italic must be used for definition lists and legends. -->
<!-- The caption, Legend to Fig X: must be presented in front of hte legend.
If the legend continues on the next page, the caption must be repeated followed by two spaces
and the text (Continued) on teh top of the continuation page. -->
<xsl:template match="definitionList/title">
<fo:block space-after="4pt" font-style="italic" keep-with-next="always">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
<xsl:template match="legend">
<fo:block font-size="11pt" font-style="italic">
<xsl:text>Legend to Fig </xsl:text>
<xsl:number count="figure" level="any" format="1" from="content"/>
<xsl:text>: </xsl:text>
</fo:block>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="definitionList">
<xsl:apply-templates select="title"/>
<fo:list-block
provisional-distance-between-starts="50mm"
provisional-label-separation="2mm">
<xsl:choose>
<xsl:when test="normalize-space(preceding-sibling::text())">
<xsl:attribute name="space-before">
<xsl:text>8pt</xsl:text>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="space-before">
<xsl:text>0pt</xsl:text>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="*[not(self::title)]"/>
</fo:list-block>
</xsl:template>
<xsl:template match="definitionListHeader">
<!-- From S1000D: The leading between the title line and the first list item must be 14 pt (equal to an extra 4 pt leading added after the title). -->
<!-- From S1000D: "If <definitionListHeader> is used to specify column titles, the column titles must be
presented in 10 pt bold and underlined." -->
<fo:list-item space-after="4pt" font-weight="bold" text-decoration="underline" keep-with-next="always">
<xsl:call-template name="CHECK-ID"> </xsl:call-template>
<xsl:apply-templates/>
</fo:list-item>
</xsl:template>
<xsl:template match="definitionListItem">
<!-- From S1000D: − a leading of 8 pt between rows and paragraph within a row" -->
<fo:list-item space-after="8pt">
<xsl:call-template name="CHECK-ID"> </xsl:call-template>
<xsl:apply-templates/>
</fo:list-item>
</xsl:template>
<!-- From S1000D: "Two columns must be used for presentation of the term (element <listItemTerm>) and its definition (element <listItemDefinition>)." -->
<!-- From S1000D: The definition list and the legend must be aligned to the left type limit and be presented in 10/11 pt. -->
<xsl:template match="definitionList/definitionListItem/listItemTerm | definitionListHeader/termTitle">
<fo:list-item-label
end-indent="label-end()"
text-align="start">
<fo:block>
<xsl:apply-templates/>
</fo:block>
</fo:list-item-label>
</xsl:template>
<xsl:template match="definitionList/definitionListItem/listItemDefinition | definitionListHeader/definitionTitle">
<fo:list-item-body
start-indent="body-start()">
<xsl:apply-templates/>
</fo:list-item-body>
</xsl:template>
<!-- PROCEDURAL STEP -->
<!-- S1000D: This attribute is intended for use only when absolutely necessary in a
situation where eg scrolling is not practical for the user or the viewing device does not allow
scrolling. The step is kept with the next sibling step (if one exists) and therefore, all
children of the element for which the attribute is set should be kept together as well (if
possible). This attribute has no meaning when placed on a final step. -->
<!-- 3031: All paragraphs addressing handling or maintenance which could damage ESD sensitive parts shall be marked with the acronym ESD as shown in the following (itemCharacteristic="ic02"). -->
<!-- 3031: Use of the acronym is described in the following list:
a. When the entire task and all subordinate paragraphs and steps relate to ESD sensitive parts, the value of the attribute independentCheck on the element <mainProcedure> shall be "ESD" and the acronym ESD shall precede the task title (e.g., ESD DISASSEMBLY). This is necessary because the element <mainProcedure> does not have an attribute itemCharacteristic.
b. When the entire task and subordinate paragraphs and steps are not directly related to ESD sensitive parts, only those which do apply shall be annotated with the acronym ESD. For example:
"REMOVAL
1. _________________
2. ESD _____________"-->
<!-- 3031: Attribute values shall be used as defined in the following table.
See TABLE XVII (Attribute values – itemCharacteristics) in the Attribute values Tables sheet. -->
<!-- 3031: All Hardness-Critical Processes shall be preceded with the acronym HCP (itemCharacteristic="ic02"). -->
<!-- 3031: a. When the entire task and all subordinate paragraphs and steps relate to establishing nuclear hardness, the value of the attribute independentCheck on the element <mainProcedure> shall be "HCP" and the acronym HCP shall precede the task title
(e.g., HCP DISASSEMBLY).
b. When the entire task and all subordinate paragraphs and steps do not contribute to establishing nuclear hardness, only those that do contribute shall be annotated with the acronym HCP. For example:
"SERVICING
1. _________________
2. HCP _____________"-->
<!-- 3031: 5.10.1.15.3 Quality Assurance (QA).
Depot and aviation maintenance procedures, which have a QA impact, shall be identified by the acronym QA in boldface letters preceding the text (itemCharacteristic="ic03"). For example:
"1. QA _____________"-->
<xsl:template match="proceduralStep | action | isolationStepQuestion | choice | yesAnswer | noAnswer">
<fo:block start-indent="21mm">
<xsl:apply-templates select="key('id',@warningRefs)"/>
<xsl:apply-templates select="warning|caution|note"/>
</fo:block>
<fo:list-block
provisional-distance-between-starts="21mm"
provisional-label-separation="4pt" wrap-option="wrap">
<xsl:if test="@keepWithNext='1'">
<xsl:attribute name="keep-together.within-page">always</xsl:attribute>
<xsl:attribute name="keep-with-next">always</xsl:attribute>
</xsl:if>
<xsl:if test="normalize-space(preceding-sibling::text())">
<xsl:attribute name="space-before">
<xsl:text>8pt</xsl:text>
</xsl:attribute>
</xsl:if>
<fo:list-item space-after="8pt" start-indent="0pt">
<xsl:call-template name="CHECK-ID"> </xsl:call-template>
<fo:list-item-label
end-indent="label-end()"
text-align="start">
<fo:block>
<xsl:choose>
<xsl:when test="self::action or self::isolationStepQuestion">
<xsl:number count="action | isolationStepQuestion" from="content" level="any" format="1"/>
</xsl:when>
<xsl:when test="self::choice or self::yesAnswer or self::noAnswer">
<xsl:number count="isolationStepQuestion | action" from="content" level="any" format="1"/>
<xsl:text>.</xsl:text>
<xsl:number count="choice | yesAnswer | noAnswer" from="isolationStepAnswer" level="any" format="1"/>
</xsl:when>
<xsl:otherwise>
<xsl:number count="proceduralStep" from="content" level="multiple" format="1.1.1.1.1"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="@itemCharacteristic">
<xsl:text> </xsl:text>
<fo:inline font-weight="bold">
<xsl:choose>
<xsl:when test="@itemCharacteristic='ic00'"/>
<xsl:when test="@itemCharacteristic='ic01'">
<xsl:text>HCP</xsl:text>
</xsl:when>
<xsl:when test="@itemCharacteristic='ic02'">
<xsl:text>ESD</xsl:text>
</xsl:when>
<xsl:when test="@itemCharacteristic='ic03'">
<xsl:text>QA</xsl:text>
</xsl:when>
<xsl:otherwise>
<fo:block color="red">
<xsl:text>Invalid value for attribute itemCharacteristic</xsl:text>
</fo:block>
</xsl:otherwise>
</xsl:choose>
</fo:inline>
</xsl:if>
</fo:block>
</fo:list-item-label>
<fo:list-item-body
start-indent="21mm">
<fo:block>
<xsl:choose>
<xsl:when test="self::yesAnswer | self::noAnswer | self::choice">
<xsl:choose>
<xsl:when test="self::yesAnswer">
<xsl:text>Yes</xsl:text>
</xsl:when>
<xsl:when test="self::noAnswer">
<xsl:text>No</xsl:text>
</xsl:when>
<xsl:when test="self::choice">
<xsl:apply-templates/>
</xsl:when>
</xsl:choose>
<xsl:text>: Go to </xsl:text>
<fo:basic-link internal-destination="{@nextActionlRefId}">
<xsl:for-each select="key('id',(@nextActionRefId))">
<xsl:text disable-output-escaping="no">Step </xsl:text>
<xsl:value-of select="(count(preceding::action | preceding::isolationStepQuestion)+1)"/>
</xsl:for-each>
</fo:basic-link>
<xsl:text>.</xsl:text>
</xsl:when>
<xsl:otherwise>
<!-- KR - 3/30/11 - Corrected xpath -->
<xsl:apply-templates select="*[not(self::warning|self::caution|self::note)]"/>
</xsl:otherwise>
</xsl:choose>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
</xsl:template>
<!-- LEVELLED PARAS -->
<xsl:template match="levelledPara">
<fo:list-block
provisional-distance-between-starts="21mm"
provisional-label-separation="4pt">
<xsl:if test="normalize-space(preceding-sibling::text())">
<xsl:attribute name="space-before">
<xsl:text>8pt</xsl:text>
</xsl:attribute>
</xsl:if>
<!-- 3031 requires title on levelled paras, so the style sheet can assume there will always be a title first. -->
<fo:list-item space-after="8pt" space-before="13pt" start-indent="0pt">
<xsl:call-template name="CHECK-ID"/>
<fo:list-item-label
end-indent="label-end()"
text-align="start">
<fo:block font-weight="bold">
<xsl:attribute name="font-size">
<xsl:choose>
<xsl:when test="count(ancestor-or-self::levelledPara)=1">
<xsl:text>14pt</xsl:text>
</xsl:when>
<xsl:when test="count(ancestor-or-self::levelledPara)=2">
<xsl:text>12pt</xsl:text>
</xsl:when>
<xsl:otherwise><xsl:text>10pt</xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:number count="levelledPara" from="content" level="multiple" format="1.1.1.1.1"/>
</fo:block>
</fo:list-item-label>
<fo:list-item-body
start-indent="body-start()">
<xsl:apply-templates/>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
</xsl:template>
<xsl:template match="levelledPara/title">
<!-- From 3031: Primary paragraph titles shall be capital case.
Block text shall start on a separate line and shall have a blank line between title and text block. -->
<xsl:choose>
<xsl:when test="count(ancestor-or-self::levelledPara)=1">
<fo:block font-size="14pt" text-transform="uppercase" font-weight="bold" space-after="8pt" keep-with-next="always">
<xsl:apply-templates select="key('id',../@applicRefId)"/>
<xsl:apply-templates select="node()"/>
</fo:block>
</xsl:when>
<!-- From 3031: Subparagraph Level 1 shall be flush left. Titles shall be bold and title case.
Block text shall start on a separate line and shall have a blank line between title and text block. -->
<xsl:when test="count(ancestor-or-self::levelledPara)=2">
<fo:block font-size="12pt" text-transform="capitalize" font-weight="bold" space-after="8pt" keep-with-next="always">
<xsl:apply-templates select="node()"/>
</fo:block>
</xsl:when>
<!-- From 3031: Subparagraph Level 2 shall be flush left. Titles shall be bold, title case, and end with a period. Block text shall start immediately after the title. -->
<xsl:when test="count(ancestor-or-self::levelledPara)=3">
<fo:inline text-transform="capitalize" font-weight="bold" space-after="8pt" keep-with-next="always">
<xsl:apply-templates select="node()"/>
<xsl:text>. </xsl:text>
</fo:inline>
</xsl:when>
<!-- Subparagraph Level 3 shall indent first line 5 spaces and the remaining text flush left. Titles shall be bold, title case and end with a period. Block text shall start immediately after the title.
-->
<xsl:when test="count(ancestor-or-self::levelledPara)=4">
<fo:inline text-transform="capitalize" font-weight="bold" space-after="8pt" space-before="13pt" keep-with-next="always">
<xsl:apply-templates select="node()"/>
<xsl:text>. </xsl:text>
</fo:inline>
</xsl:when>
<!-- Subparagraph Level 4 shall indent first line 10 spaces and the remaining text flush left. Titles shall be bold, title case and end with a period. Block text shall start immediately after the title.
-->
<xsl:when test="count(ancestor-or-self::levelledPara)=5">
<fo:inline text-transform="capitalize" font-weight="bold" space-after="8pt" space-before="13pt" keep-with-next="always">
<xsl:apply-templates select="node()"/>
<xsl:text>. </xsl:text>
</fo:inline>
</xsl:when>
<xsl:otherwise>
<fo:block><xsl:text>Cannot format a levelledPara deeper than 5 levels.</xsl:text></fo:block>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
gopher://khzae.net/0/s1kd/links/projects/3031/Army S1000D Stylesheets/FO-3031-A00-USARMY-LISTS_001-00_EN-US.xsl